/**
 * @param {number[]} widths
 * @param {string} s
 * @return {number[]}
 */
export var numberOfLines = function (widths, s) {
  let line = 1,
    cur = 0
  for (let i = 0; i < s.length; i++) {
    let w = widths[s[i].charCodeAt() - 97]
    if (cur + w > 100) {
      line++
      cur = w
    } else {
      cur += w
    }
  }
  return [line, cur]
}
